/*! \file logingui.cpp		
	This contains the implementation of the LoginGUI class
*/

#include "logingui.h"

HoverText* HoverText::instance = 0;

LoginGUI::LoginGUI() :
	Container( GUI::getInstance(), true ),
	userText( this, "Username:" ),
	userField( this ),
	passText( this, "Password:" ),
	passField( this ),
	acceptButton( this, "Accept" ),
	cancelButton( this, "Cancel" )
{
	setDraggable();
	//~ setResizable();
	setPosition( 50, 50 );
	
	userField.setBorder( true );
	passField.setBorder( true );
	
	t = new TestObserver();
	
	acceptButton.addListener( t );
	cancelButton.addListener( t );

	acceptButton.setBorder( true );
	cancelButton.setBorder( true );

	setOkayButton( &acceptButton );
	setCancelButton( &cancelButton );
	
	acceptButton.addListener( &test );
	//~ addListener( &test );
	
	setFocus( &userField );
	setSize( 350, 250 ); // calls layout
}

void LoginGUI::layout() {
	userField.setPosition( 115, 20 );
	userField.setSize( 200, 50 );
	passField.setPosition( 115, 85 );
	passField.setSize( 200, 50 );
	acceptButton.setPosition( 80,175);
	acceptButton.setHeight( 50 );
	cancelButton.setPosition( 200,175);
	cancelButton.setHeight( 50 );
	userText.setPosition( 15, 47 );
	passText.setPosition( 15, 115 );
}
